<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * Ajax Drop Node
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 06.06.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/

    /***
    * class ajaxUpdateUserMail
    ****
    * This class will update a user's e-mail address
    ****
    * @package ajax
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 06.06.2005
    * @copyright essentialmind.com 2005
    ***/
    class ajaxUpdateUserMail extends ajaxAction{

        public function process(){
            //try to drop the node
            try{
               $newMail = trim($this->unescape($_REQUEST['value']));
               $id      = (int)$_REQUEST['id'];
               
               if(empty($newMail)){
                    $newMail = 'n/a';   
               }
               
               //delete the user!
               $this->db->Execute("UPDATE user_data SET email = '$newMail' WHERE uid = " . $id);
               
               //log action
               $this->log->recordAction("Ajax: Updated e-mail of user (".$id.") to \"$newMail\"");
                
            //something went wrong
            }catch(exception $e){
                //log error
                $this->log->recordError($e->getMessage());

                //do nothing
            }
            
			$this->r->html = $newMail;
        }
    }
?>